<me:UILAGPL x:Class="WPFExcelReport.TLAGPL"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"   
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UILAGPL.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UILAGPL.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="1*"></RowDefinition>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0">
                <WrapPanel  Grid.Row="0">
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button  Click="EditCommand" Width="24" Height="20">
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <me:TSLO   Grid.Column="0" LO="{Binding LO,ElementName=TV}"/>
                        <me:TSLB   Grid.Column="1" LB="{Binding LB,ElementName=TV}"
                                   LPLO="{Binding LO,ElementName=TV}"/>
                    </Grid>
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=库:}}"></TextBlock>
                        <ex:TXT72   Grid.Column="1" CharacterCasing="Upper" 
                                  Text="{Binding LO,ElementName=TV}" Width="200" />
                    </Grid>
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=区:}}"></TextBlock>
                        <ex:TXT72   Grid.Column="1" CharacterCasing="Upper" 
                                  Text="{Binding LB,ElementName=TV}" Width="200" />
                    </Grid>
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                 </WrapPanel>
                <WrapPanel>
                    <Button   Width="24" Height="20">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>

                    <Button   Click="NewCommand" Content="{Binding Source={Localization:Translate Word=新库}}" Height="20" Margin="5,0,0,0" Width="Auto" />
                    <Button   Click="NewLBCommand" Content="{Binding Source={Localization:Translate Word=新库区}}" Height="20" Margin="5,0,0,0" Width="Auto" />
                    <Button   Click="NewLPCommand" Content="{Binding Source={Localization:Translate Word=新库位}}" Height="20" Margin="5,0,0,0" Width="Auto" />

                    <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                        <Grid Margin="10,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=库:}}"></TextBlock>
                            <ex:TXT72  PRE="  "  MaxLength="2"  Grid.Column="1" CharacterCasing="Upper" 
                                  Text="{Binding LO,ElementName=TV}" Width="40" />
                        </Grid>
                        <Grid Margin="10,0,0,0" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=区:}}"></TextBlock>
                            <ex:TXT72   PRE="  "  MaxLength="2" Grid.Column="1" CharacterCasing="Upper" 
                                  Text="{Binding LB,ElementName=TV}" Width="40" />
                        </Grid>

                        <Grid Margin="10,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=位:}}"></TextBlock>
                            <ex:TXT72   MaxLength="8" Grid.Column="1" CharacterCasing="Upper" 
                                  Text="{Binding LP,ElementName=TV}" Width="80" />
                        </Grid>

                        <Grid Margin="10,0,0,0" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                    </WrapPanel>
                </WrapPanel>
            </StackPanel>
            <StackPanel Grid.Row="1">
                <me:TDL03 Margin="20,20,20,20"
                 IsEdit="{Binding IsEdit,ElementName=TV}"
                 IsSaved="{Binding IsSaved,ElementName=TV}"
                ORDERNUM="{Binding KEY,ElementName=TV}"
                    KEY="{Binding ORDERNUM,ElementName=TV}"
                    />
            </StackPanel>
            <DataGrid  Grid.Row="2"  
                   VerticalAlignment="Top" 
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"  
                   ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                   IsSynchronizedWithCurrentItem="True" 
                   IsReadOnly="True"
                   x:Name="dlgMaster" 
                   RowDetailsVisibilityMode="Visible"  
                >
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=LPLO}" Header="{Binding Source={Localization:Translate Word=LO}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=LPLB}" Header="{Binding Source={Localization:Translate Word=LB}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=LPPLATZ}" Header="{Binding Source={Localization:Translate Word=LP}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=LPKBEZ, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=简述}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=LPBEZ, Converter={StaticResource gb2312}}"   Header="{Binding Source={Localization:Translate Word=描述}}"   />
                    <DataGridTextColumn Binding="{Binding Path=LPAENDBEN}" Header="{Binding Source={Localization:Translate Word=修改}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=LPAENDDAT}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=LPNEUBEN}" Header="{Binding Source={Localization:Translate Word=创建}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=LPNEUDAT}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
                </DataGrid.Columns>
            </DataGrid  >
        </Grid>
       
        <WrapPanel Grid.Row="1">

        </WrapPanel>
    </Grid>
</me:UILAGPL>
